#coding:utf8
#author:HaxtraZ
class Calc(object):
    def __init__(self,e):
        self.e = e
        self.x = 0
        self.v = 0

    def calc(self):
        e = self.e + "+"
        op = ['+','-','=']
        front = None
        last_op = None
        last_n = 1
        last_var = None
        last_v = None
        for i in range(len(e)):
            x = e[i]
            if x.isdigit():
                if last_v is not None and last_v.isdigit():
                    last_n = last_n * 10 + int(x)
                else:
                    last_n = int(x)
            elif x in op:
                if last_var is None:
                    if last_op is '-':
                        self.v = self.v-last_n
                    else:
                        self.v +=last_n
                else:
                    if last_op is '-':
                        self.x -= last_n
                    else:
                        self.x += last_n
                last_op = x
                last_n = 1
                last_var = None
            else:
                last_var = x

            if (x == '='):
                self.x = -self.x
                self.v = -self.v
                last_op = None
                last_n = 1
                last_var = None

            last_v = x
        x_v = self.v*1.0 / (-self.x)
        print("%.3f"%x_v)
# def calSn(Sn,n):
#     Sn = Sn + 1.0/n
#     print("calsn = %d,n=%d",Sn,n)
#     return Sn
#
# def cal(Sn,k,n):
#     Sn = calSn(Sn,n)
#     print("sn...",Sn)
#     if Sn > k:
#         return n
#     else:
#         cal(Sn,k,n+1)

def is_digit(x):
    if(x.isdigit()==True):
        pass

    xtype = z
    if(type(eval(x))  is not 'int'):
        print (x)

if __name__ == "__main__":
    # k = input("input k:")
    k = "2x+2=8"
    print(k)
    while(1):
        exp = raw_input("input expression:")
        calc = Calc(exp)
        calc.calc()
